home *** CD-ROM | disk | FTP | other *** search
/ Aminet 40 / Aminet 40 (2000)(Schatztruhe)[!][Dec 2000].iso / Aminet / dev / misc / TCS.lha / TCS / demos / cod / TriBuf.s < prev    next >
Encoding:
Text File  |  2000-09-26  |  3.1 KB  |  114 lines

  1. *******************************************************************************
  2. * simple triple buffering example
  3. *******************************************************************************
  4. * INFO    shows how to work with a FullRes triple buffered display
  5. * NOTE    - experiment with the display definition parameters
  6. *    - LMB to exit anytime
  7. *******************************************************************************
  8.  
  9.     machine    68020
  10.  
  11.     include    INCLUDES:libraries/tcs.i
  12.     include    INCLUDES:libraries/tcs_lib.i
  13.     include    /inc/macros.i
  14.  
  15.  
  16.  
  17. *******************************************************************************
  18. * custom display definitions
  19. *******************************************************************************
  20.  
  21. DSPLWD    =    320    ;our TCS display width and
  22. DSPLHT    =    256    ;height (LORES pixels)
  23. SCRWD    =    320    ;TCS screen width and
  24. SCRHT    =    256    ;height (FullRes pixels)
  25. DSPLX0    =    $81*4    ;display start
  26. DSPLY0    =    $2c    ;position (SHRES pixels)
  27. DSPLX1    =    DSPLX0+DSPLWD*4    ;display end
  28. DSPLY1    =    DSPLY0+DSPLHT    ;position (SHRES pixels)
  29. DSPLBRTNS    =    256    ;max brightness
  30. GFXCTXT    =    0    ;graphic context
  31. CWBTM    =    0    ;clipping
  32. CWTOP    =    0    ;window
  33. CWRT    =    0    ;borders
  34. CWLF    =    0    ;coordinates
  35. VDOMODE    set    TCS_VM_RGBW | TCS_VMf_FullRes
  36. VDOMODE    set    VDOMODE | TCS_VMf_TriBuf    ;display video mode
  37.  
  38.  
  39.  
  40. *******************************************************************************
  41. * code start
  42. *******************************************************************************
  43.  
  44.     include    /inc/shl_strtup.i
  45.  
  46.  
  47.  
  48. *******************************************************************************
  49. * init
  50. *******************************************************************************
  51.  
  52. _PrgInit    move.w    #0,ccr    ;OK!
  53.     rts
  54.  
  55.  
  56.  
  57. *******************************************************************************
  58. * main
  59. *******************************************************************************
  60.  
  61. _PrgMain    move.l    #TriBufHndlr,([_VBR.l],$6c.w) ;set level3 autovector
  62.     move.w    #$c020,$dff09a    ;set INTENA.INTEN/VERTB
  63.  
  64. .lp    movea.l    DIAdr,a0    ;our display
  65.     moveq.l    #0,d0    ;x0
  66.     moveq.l    #0,d1    ;y0
  67.     move.w    #SCRWD-1,d2    ;x1
  68.     move.w    #SCRHT-1,d3    ;y1
  69.     move.b    #255,d4    ;color
  70.     CALLTCS    DrwFrm0    ;mark screen with a rectangle
  71.  
  72.     movea.l    DIAdr,a0    ;render FullRes screen
  73.     CALLTCS    CPUFRPass0    ;to make changes visible
  74.  
  75.     movea.l    DIAdr,a0    ;acknowledge screen
  76.     CALLTCS    TriUpd    ;rendering completion
  77.  
  78.     btst.b    #6,$bfe001
  79.     bne.s    .lp    ;if not LMB...
  80.     rts
  81.  
  82.  
  83.  
  84. *******************************************************************************
  85. * cleanup
  86. *******************************************************************************
  87.  
  88. _PrgClnUp    rts
  89.  
  90.  
  91.  
  92. *******************************************************************************
  93. * triple buffer handler (level 3 interrupt handler)
  94. *******************************************************************************
  95.  
  96. TriBufHndlr    btst.b    #5,$dff01f
  97.     beq.s    .exit    ;if not INTREQR.VERTB...
  98.     movem.l    d0-d1/a0-a1/a6,-(sp)
  99.  
  100.     movea.l    DIAdr,a0
  101.     CALLTCS    TriSwp    ;swap screen buffers
  102.  
  103.     movem.l    (sp)+,d0-d1/a0-a1/a6
  104. .exit    move.w    #$70,$dff09c    ;clr INTREQ.BLIT/VERTB/COPER
  105.     rte
  106.  
  107.  
  108.  
  109. *******************************************************************************
  110. * data
  111. *******************************************************************************
  112.  
  113.     include    /inc/dat.i
  114.